<template>
  <div class="loginContent">
    <div class="formBody">
      <el-form :model="formLogin">
        <el-form-item><h2 class="title">文章发布后台管理系统</h2></el-form-item>
        <el-form-item
          ><el-input v-model="formLogin.UserName" placeholder="账号"></el-input
        ></el-form-item>
        <el-form-item
          ><el-input
            type="password"
            v-model="formLogin.Password"
            placeholder="密码"
          ></el-input
        ></el-form-item>
        <el-form-item>
          <el-button type="primary" @click="handleLogin">登陆</el-button>
          <span v-show="this.errorInfo.isShowError" class="error">{{
            this.errorInfo.text
          }}</span>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
import request from "./utils/request.js";
export default {
  name: "Login",
  data() {
    return {
      id: 3,
      formLogin: {
        //表单对象
        UserName: "admin",
        Password: "admin",
      },
      apiUrl: process.env.VUE_APP_BASE_ELM_API,
      errorInfo: {
        text: "登陆失败,请重试",
        isShowError: false, //显示错误提示
      },
    };
  },
  methods: {
    handleLogin() {
      sessionStorage.setItem("sysuser", JSON.stringify(this.formLogin));
      /*var that =this;
          var UserName = that.formLogin.UserName;
          var Password = that.formLogin.Password;
			request({
				url: that.apiUrl + '/Common/CheckLoginSysUser',
				 method: 'post',
				data:{UserName, Password}
			}).then(function(response) {

				console.log(response);
			});*/
      this.$router.push({ path: "/mycenter" });
    },
  },
};
</script>

<style scoped="scoped">
.loginContent {
  background-image: url(assets/images/bg.jpg);
  background-repeat: no-repeat;
  background-size: cover;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.formBody {
  margin: auto;
  width: 460px;
  height: 296px;
  background: #fff;

  border: 1px solid #eaeaea;
  box-shadow: 0 0 25px #cac6c6;
}
.formBody .title {
  text-align: center;
  color: #505458;
  margin-top: 10px;
}
.el-form {
  margin: 30px 80px auto 80px;
}
</style>
